using System;
using System.Reflection;
using SwinGame;
using Color = System.Drawing.Color;

namespace SurvivalNN.src
{
    public class GameMain
    {
        public static void Main()
        {
            //Start the audio system so sound can be played
            Audio.OpenAudio();

            //Open the game window
            Graphics.OpenGraphicsWindow("GameMain", 800, 600);

            EntityModel em = new EntityModel();
            SimplePropView pv = new SimplePropView(em);
            //PropController pc = new PropController(em);
            PlayerPropController ppc = new PlayerPropController(em);
            em.Position = new Vector() { X = 200, Y = 200 };
            

            //Run the game loop
            while (false == Input.WindowCloseRequested())
            {
                //Fetch the next batch of UI interaction
                Input.ProcessEvents();
                float dt = 1f / (float)SwinGame.Utils.GetFramerate();

                ppc.PollInput(dt);
                em.Update(dt);
                //pc.MovePropAction(true, new Vector() { X = 0.01f, Y = 0.01f });
                //Clear the screen and draw the framerate
                Graphics.ClearScreen(Color.White);
                Text.DrawFramerate(0, 0);
                pv.Draw();
                //Draw onto the screen
                Graphics.RefreshScreen();
            }

            //End the audio
            Audio.CloseAudio();

            //Close any resources we were using
            Resources.ReleaseAllResources();
        }
    }
}